<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>用户管理</title>
		<%@ include file="/common/meta.jsp"%>
		<link href="${ctx}/css/css.css" rel="stylesheet" type="text/css" />
		<link href="${ctx}/js/validate/jquery.validate.css" type="text/css"
			rel="stylesheet" />
		<script src="${ctx}/js/jquery.js" type="text/javascript"></script>
		<script src="${ctx}/js/validate/jquery.validate.js"
			type="text/javascript"></script>
		<script src="${ctx}/js/validate/messages_cn.js" type="text/javascript"></script>
		<script src="${ctx}/js/table.js" type="text/javascript"></script>
		<script>
			$(document).ready(function(){
				//聚焦第一个输入框
				$("#loginName").focus();
				//为inputForm注册validate函数
				$("#inputForm").validate({
					rules: { 
						loginName: { 
	        				required: true,
	        				remote: "user!checkLoginName.action?oldLoginName="+encodeURIComponent('${loginName}')
	    				},
	          			name: "required",
	          			password: {
	    					required: true,
	    					minlength:6
	    				}, 
	    				passwordConfirm: {
	    					equalTo:"#password"
	    				},
	    				email:"email"
					},
					messages: { 
						loginName: {
							remote: "用户登录名已存在"
						},
						passwordConfirm: {
							equalTo: "输入与上面相同的密码"
						}
					}
				});
			});
			
		</script>
	</head>
	<body>
		<form id="inputForm" action="../security/user!save.action"
			method="post">
			<input type="hidden" name="id" value="${id}" />
			<div id="main">
				<div class="x-panel-header">
					<img src="${ctx}/images/default/sizer/se-handle-dark.gif" />
					用户管理
				</div>
				<div class="x-panel-mr">
					<div class="x-panel-mc">
						<div class="x-panel-tbar">
							<div class="x-toolbar">
								<s:if test="id == null">创建</s:if>
								<s:else>修改</s:else>
								用户
							</div>

							<table class="table-normal">
								<colgroup>
									<col style="WIDTH: 20%" />
									<col style="WIDTH: 30%" />
									<col style="WIDTH: 20%" />
									<col style="WIDTH: 30%" />
								</colgroup>

								<tr class="rightframe-tr">
									<th>
										用户名:
									</th>
									<td class="rightframe-tr-right rightframe-tr-body">
										<input type="text" id="loginName" name="loginName"
											value="${loginName }" maxlength="20" />
										<font color="red">&nbsp;*</font>
									</td>
									<th>
										真实姓名:
									</th>
									<td class="rightframe-tr-right rightframe-tr-body">
										<input type="text" id="name" name="name" value="${name }"
											maxlength="20" />
										<font color="red">&nbsp;*</font>
									</td>
								</tr>
								<tr class="rightframe-tr">
									<th>
										密码:
									</th>
									<td class="rightframe-tr-right rightframe-tr-body">
										<input type="password" id="password" name="password"
											value="${password }" maxlength="20" />
										<font color="red">&nbsp;*</font>
									</td>
									<th>
										确认密码:
									</th>
									<td class="rightframe-tr-right rightframe-tr-body">
										<input type="password" id="passwordConfirm"
											name="passwordConfirm" value="${password }" maxlength="20" />
										<font color="red">&nbsp;*</font>
									</td>
								</tr>
								<tr class="rightframe-tr">
									<th>
										邮箱:
									</th>
									<td class="rightframe-tr-right rightframe-tr-body">
										<input type="text" id="email" name="email" value="${email }"
											maxlength="40" />
										<font color="red">&nbsp;*</font>
									</td>
								</tr>
							</table>
							<table cellpadding="0" cellspacing="0" width="100%">
								<tr>
									<td class="infoHeightTop" height="20">
									</td>
								</tr>
							</table>
							<table cellpadding="0" cellspacing="0" width="100%">
								<tr>
									<td align="right">
										<input type="submit" value="保 存"
											class="tel_button left-margin-20" />
										<input type="button" value="返 回" onclick="history.back();"
											class="tel_button left-margin-20" />
									</td>
								</tr>
							</table>						
						</div>
					</div>
				</div>
			</div>
		</form>
	</body>
</html>